﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Experts.Framework.Mapping;
using Experts.Framework.Validate;

namespace Experts.Model
{
    /// <summary>
    /// 主键特性
    /// </summary>
    public class PrimaryKeyAttribute : Attribute
    {
        public PrimaryKeyAttribute(bool bIspKey)
        {
            this.isPKey = bIspKey;
        }
        private bool isPKey;
        public bool IsPKey
        {
            get { return isPKey; }
        }
    }

    public class NonTableAttribute : Attribute
    {
        private bool isNoFiled;
        public bool IsNonFiled { get { return isNoFiled; } }
        public NonTableAttribute(bool bIsKey)
        {
            this.isNoFiled = bIsKey;
        }
    }
    [AttributeUsage(AttributeTargets.Property)]
    public class IdentityAttribute : Attribute
    {
        public bool IsIdentity { get; set; }
    }
    /// <summary>
    /// 用户实体类
    /// </summary>
    [Serializable]
    [TableAttribute("db_User")]
    public class User:BaseModel
    {
        //[Identity(IsIdentity = true)]
        //[PrimaryKey(true)]
        //public int Id { get; set; }

        #region 普通属性

        [RequiredAttribute]
        [StringLength(5,50)]
        public string UserName { get => userName; set => userName = value; }
        public int Sex { get => sex; set => sex = value; }
        public string Password { get => password; set => password = value; }
        public int UserType { get => userType; set => userType = value; }
        public string Company { get => company; set => company = value; }
        public string Phone { get => phone; set => phone = value; }
        public string Email { get => email; set => email = value; }
        public string OpenId { get => openId; set => openId = value; }
        public int State { get => state; set => state = value; }
        public DateTime CreateDate { get => createDate; set => createDate = value; }
        public string Verifier { get => verifier; set => verifier = value; }
        public string VerifyDate { get => verifyDate; set => verifyDate = value; }

        private string userName;
        private int sex;
        private string password;
        private int userType;
        private string company;
        private string phone;
        private string email;
        private string openId;
        private int state;
        private DateTime createDate;
        private string verifier;
        private string verifyDate;
        #endregion
    }
}
